package com.example.changtest.util

import android.util.Log
import com.example.changtest.BuildConfig
import com.google.gson.Gson



/**
 * @Description:logUtil
 * @author: zcs
 * @email: 1059737741@qq.com
 * create at 2021/12/31 15:10
 */
object LogUtil {

    private val isTest = BuildConfig.DEBUG
    private const val TAG = "zcs"
    private val gson = Gson()


    fun e(msg: String?) {
        if (isTest) {
            msg?.let { Log.e(TAG, it) }
        }
    }

    fun e(tag: String, msg: String?) {
        if (isTest) {
            msg?.let { Log.e(tag, it) }
        }
    }


    fun e(obj: Any?) {
        if (isTest) {
            gson.toJson(obj)?.let {
                Log.e(TAG, it)
            }
        }
    }

    fun e(tag: String?, obj: Any?) {
        if (isTest) {
            gson.toJson(obj)?.let {
                Log.e(tag, it)
            }
        }
    }
}